'''
Created on 2010-2-12

@author: summit
'''
from Container import *

class Stack(Container):
    '''
    The abstract Stack class extends the abstract Container class 
    '''


    def __init__(self):
        '''
        Constructor
        '''
        super(Stack, self).__init__()
    
    def getTop(self):
        pass
    getTop = AbstractMethod(getTop)
    
    top = property(fget=lambda self: self.getTop())
    
    def push(self, obj):
        pass
    push = AbstractMethod(push)
    
    def pop(self):
        pass
    pop = AbstractMethod(pop)
    
    def test(stack):
        "Stack test program."
        print Stack.test.__doc__
        for i in xrange(6):
            if not stack.isFull:
                stack.push(i)
        print stack
        print "Using iterator"
        for obj in stack:
            print obj
        print "Top is", stack.top
        print "Popping"
        while not stack.isEmpty:
            obj = stack.pop()
            print obj
    test = staticmethod(test)
        